import { request, baseURl } from '../utils/request.js';

export function startOneTask(url) {
    return request.post('/start_one_task', { url });
}

export function getDownloadOneTaskUrl(taskId) {
    if (window.pywebview && window.pywebview.api && typeof window.pywebview.api.download_file === 'function') {
        window.pywebview.api.download_file(`${baseURl}/download_one_task/${taskId}`)
    } else {
        window.open(`${baseURl}/download_one_task/${taskId}`);
    }
}